﻿using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
using xiaodingmarket_Domain.Commands;

namespace xiaodingmarket_Domain.Validations
{
    /// <summary>
    /// 定义基于 CommodityCommand 的抽象基类 CommandValidation
    /// </summary>
    /// <typeparam name="T">泛型类</typeparam>
    public abstract class CommodityValidation<T> : AbstractValidator<T> where T : CommodityCommand
    {
        //command基类属性还会随其他子类comand创建变化，这里只验证id作为示例，后续再添加
        protected void ValidateId()
        {
            RuleFor(c => c.Id)
                .NotEqual(Guid.Empty);
        }
    }
}
